import { baseURL } from '@/sheep/config';
import Content from '@/sheep/layouts/content.vue';
import { request } from '@/sheep/request';
import { SELECT, RECYCLE_BIN, CRUD, RECYCLE } from '@/sheep/request/crud';

const route = {
  path: 'goods',
  name: 'supplychian.admin.goods',
  component: Content,
  meta: {
    title: '商品管理',
  },
  children: [
    {
      path: 'index',
      name: 'supplychian.admin.goods.list',
      component: () => import('./list/index.vue'),
      meta: {
        title: '商品管理',
      },
    },
    {
      path: 'store',
      name: 'supplychian.admin.goods.store',
      component: () => import('./store/index.vue'),
      meta: {
        title: '我的选品库',
      },
    },
    {
      path: 'addgoods',
      name: 'supplychian.admin.goods.store.addgoods',
      component: () => import('./store/addgoods.vue'),
      meta: {
        title: '添加选品',
      },
    },
    // {
    //   path: 'address',
    //   name: 'taxation.admin.industry.address',
    //   component: () => import('./address/index.vue'),
    //   meta: {
    //     title: '注册地址',
    //   },
    // },
  ],
};

const api = {
  goods:{
    ...CRUD('shop/admin/goods/goods'),
  },
  // 获取供应商列表
  supplyList: (params) =>
    request({
      url: '/shop/yb/goods/channelgoods/channelList',
      method: 'GET',
      params,
    }),
  // 获取启用的价格模板
  getPriceTemp: (params) =>
    request({
      url: '/shop/yb/goods/channelgoods/getPriceTemp',
      method: 'GET',
      params,
    }),
  // 获取选品库
  getStoreList: (data) =>
    request({
      url: '/shop/yb/goods/channelgoods/getChannelHouseList',
      method: 'POST',
      data,
    }),
  // 新增选品库
  addStore: (data) =>
    request({
      url: '/shop/yb/goods/channelgoods/addChannelHouse',
      method: 'POST',
      data,
    }),
  // 修改选品库
  editStore: (data) =>
    request({
      url: '/shop/yb/goods/channelgoods/editChannelHouse',
      method: 'POST',
      data,
    }),
  // 获取渠道商品列表
  goodList: (data) =>
    request({
      url: '/shop/yb/goods/channelgoods/list',
      method: 'POST',
      data,
    }),
  // 选中商品入库
  addGoods: (data) =>
    request({
      url: '/shop/yb/goods/channelgoods/addYzhGoods',
      method: 'POST',
      data,
    }),
  // 获取商品库中的商品
  getGoodsList: (data) =>
    request({
      url: '/shop/yb/goods/channelgoods/getHouseGoods',
      method: 'POST',
      data,
    }),
  // 获取商品库中商品详情
  getGoodsDetail: (id) =>
    request({
      url: `/shop/yb/goods/channelgoods/getHouseGoodsDetails/${id}`,
      method: 'GET',
    }),
  // 获取商品分类接口
  getGoodsClass: (data) =>
    request({
      url: '/shop/yb/goods/channelgoods/getGoodsCategory',
      method: 'POST',
      data,
    }),
    // 保存库中商品
    saveGoods: (data) =>
    request({
      url: '/shop/yb/goods/channelgoods/saveHouseGoods',
      method: 'POST',
      data,
    }),
    // 获取店铺列表
    getShopList: (data) =>
    request({
      url: '/shop/yb/goods/channelgoods/getStoreList',
      method: 'GET',
      params:data,
    }),
    // 删除选品库
    delChannelHouse: (id) =>
    request({
      url: `/shop/yb/goods/channelgoods/delChannelHouse/${id}`,
      method: 'GET',
    }),
    // 删除商品
    delChannelGoods: (id) =>
    request({
      url: `/shop/yb/goods/channelgoods/delChannelGoods/${id}`,
      method: 'GET',
    }),
    // 上下架商品
    shopgoods: (id,data) =>
    request({
      url: `/shop/admin/goods/goods/${id}`,
      method: 'PUT',
      data
    }),

  // 获取服务商列表
  serviceList: (params) =>
    request({
      url: '/main/admin/application/application/agentList',
      method: 'GET',
      params,
    }),
  checkInAssagn: (data) =>
    request({
      url: '/main/admin/application/application/assign',
      method: 'POST',
      data,
    }),
  type: () =>
    request({
      url: '/main/admin/application/application/typeList',
      method: 'GET',
    }),
    service: {
        ...CRUD('shop/admin/goods/service'),
        select: (params) => SELECT('shop/admin/goods/service', params),
      },

  // 1688
  // 1688我的选品库列表
  shopcategory_list: (data) =>
    request({
      url: '/shop/api/goods/addgoods/category_list',
      method: 'GET',
      params:data,
      custom: {
        // baseURL: 'https://api-dev2-shop.jxzc.tjbj.cc/',
        showErrorMessage:'1688'
      },
    }),
  // 1688下架商品删除
  shopdown_delt: (data) =>
    request({
      url: '/shop/api/goods/addgoods/down_del',
      method: 'POST',
      data,
      custom: {
        // baseURL: 'https://api-dev2-shop.jxzc.tjbj.cc/',
      },
    }),
  // 1688创建新的选品库
  shopadd_category: (data) =>
    request({
      url: '/shop/api/goods/addgoods/add_category',
      method: 'POST',
      data,
      custom: {
        // baseURL: 'https://api-dev2-shop.jxzc.tjbj.cc/',
      },
    }),
    // 1688删除选品库
  shopcategory_del: (data) =>
    request({
      url: '/shop/api/goods/addgoods/category_del',
      method: 'POST',
      data,
      custom: {
        // baseURL: 'https://api-dev2-shop.jxzc.tjbj.cc/',
      },
    }),
  // 1688编辑选品库
  shopedit_category: (data) =>
    request({
      url: '/shop/api/goods/addgoods/edit_category',
      method: 'POST',
      data,
      custom: {
        // baseURL: 'https://api-dev2-shop.jxzc.tjbj.cc/',
      },
    }),
  // 1688我的选品库商品
  shopmy_goods_list: (data) =>
    request({
      url: '/shop/api/goods/addgoods/my_goods_list',
      method: 'GET',
      params:data,
      custom: {
        // baseURL: 'https://api-dev2-shop.jxzc.tjbj.cc/',
        showErrorMessage:'1688'
      },
      
    }),
    // 1688商品列表
  shopgood_list: (data) =>
    request({
      url: '/shop/api/goods/addgoods/good_list',
      method: 'GET',
      params:data,
      custom: {
        // baseURL: 'https://api-dev2-shop.jxzc.tjbj.cc/',
        showErrorMessage:'1688'
      },
      
    }),
    // 1688类目列表
  shopcategory: (data) =>
    request({
      url: '/shop/api/goods/addgoods/category',
      method: 'GET',
      params:data,
      custom: {
        // baseURL: 'https://api-dev2-shop.jxzc.tjbj.cc/',
        showErrorMessage:'1688'
      },
      
    }),
    // 1688商品加入选品库
  shopadd_my_goods: (data) =>
    request({
      url: '/shop/api/goods/addgoods/add_my_goods',
      method: 'POST',
      data,
      custom: {
        // baseURL: 'https://api-dev2-shop.jxzc.tjbj.cc/',
        showErrorMessage:'1688'
      },
      
    }),
    // 1688商品详情
  shopaddgoodsdetail: (data) =>
    request({
      url: '/shop/api/goods/addgoods/detail',
      method: 'GET',
      params:data,
      custom: {
        // baseURL: 'https://api-dev2-shop.jxzc.tjbj.cc/',
        showErrorMessage:'1688'
      },
      
    }),
    // 1688商品编辑上架
  shopaddgoods_edit: (data) =>
    request({
      url: '/shop/api/goods/addgoods/goods_edit',
      method: 'POST',
      data,
      custom: {
        // baseURL: 'https://api-dev2-shop.jxzc.tjbj.cc/',
        // showErrorMessage:'1688'
      },
      
    }),
    tags: {
      ...CRUD('shop/admin/goods/activityTag/crud'),
      select: (params) => SELECT('shop/admin/goods/activityTag', params),
    },
};

export { route, api };
